#include <stdio.h>

void reorderArray(int arr[], int len) {
    int i = 0, j = len - 1;

    while (i < j) {
        while (i < j && arr[i] % 2 == 0) {
            i += 1;
        }
        while (i < j && arr[j] % 2 == 1) {
            j -= 1;
        }

        if (i < j) {
            int temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }
    }
}

int main() {
    int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    int len = sizeof(arr) / sizeof(arr[0]);
    reorderArray(arr, len);
    for (int i = 0; i < len; i++) {
        printf("%d ", arr[i]);
    }
    return 0;
}